package com.example.goods_manage.controller;

import com.example.goods_manage.dto.Goods;
import com.example.goods_manage.dto.request.GoodsRequest;
import com.example.goods_manage.service.GoodsService;
import com.example.goods_manage.utils.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <P> @Author: SongKeCheng
 * <P> Type: Class
 * <P> Description:
 * <P> Date: 2024/9/5:11:07
 */
@RestController
@RequestMapping("goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    @GetMapping("/findGoods")
    public AjaxResult findGoods(GoodsRequest goodsRequest){
       return goodsService.findGoods(goodsRequest);
    }

    @PostMapping("/addGoods")
    public AjaxResult addGoods(@RequestBody GoodsRequest goodsRequest){
        return goodsService.addGoods(goodsRequest);
    }


    @DeleteMapping("deleteGoods")
    public AjaxResult deleteGoods(GoodsRequest goodsRequest){
        return goodsService.deleteGoods(goodsRequest);
    }

    @PostMapping("/updateGoods")
    public AjaxResult updateGoods(@RequestBody GoodsRequest goodsRequest){
        return goodsService.updateGoods(goodsRequest);
    }

}
